/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author freis
 */
@Entity
@Table(name = "papeis")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Papeis.findAll", query = "SELECT p FROM Papeis p"),
    @NamedQuery(name = "Papeis.findByIdPapeis", query = "SELECT p FROM Papeis p WHERE p.idPapeis = :idPapeis"),
    @NamedQuery(name = "Papeis.findByNome", query = "SELECT p FROM Papeis p WHERE p.nome = :nome")})
public class Papeis implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPapeis")
    private Integer idPapeis;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nome")
    private String nome;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "papeis")
    private Collection<PapeisHasActividades> papeisHasActividadesCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "papeis")
    private Collection<PapeisHasProcessos> papeisHasProcessosCollection;

    public Papeis() {
    }

    public Papeis(Integer idPapeis) {
        this.idPapeis = idPapeis;
    }

    public Papeis(Integer idPapeis, String nome) {
        this.idPapeis = idPapeis;
        this.nome = nome;
    }

    public Integer getIdPapeis() {
        return idPapeis;
    }

    public void setIdPapeis(Integer idPapeis) {
        this.idPapeis = idPapeis;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    @XmlTransient
    public Collection<PapeisHasActividades> getPapeisHasActividadesCollection() {
        return papeisHasActividadesCollection;
    }

    public void setPapeisHasActividadesCollection(Collection<PapeisHasActividades> papeisHasActividadesCollection) {
        this.papeisHasActividadesCollection = papeisHasActividadesCollection;
    }

    @XmlTransient
    public Collection<PapeisHasProcessos> getPapeisHasProcessosCollection() {
        return papeisHasProcessosCollection;
    }

    public void setPapeisHasProcessosCollection(Collection<PapeisHasProcessos> papeisHasProcessosCollection) {
        this.papeisHasProcessosCollection = papeisHasProcessosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPapeis != null ? idPapeis.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Papeis)) {
            return false;
        }
        Papeis other = (Papeis) object;
        if ((this.idPapeis == null && other.idPapeis != null) || (this.idPapeis != null && !this.idPapeis.equals(other.idPapeis))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Papeis[ idPapeis=" + idPapeis + " ]";
    }
    
}
